//package com.inspur.edp.cef.generator.coreGenerator.entityGenerator.entityGenerator;
//
//
//import com.inspur.edp.caf.generator.BaseGenerator;
//import com.inspur.edp.caf.generator.baseInfo.AnnotationInfo;
//import com.inspur.edp.caf.generator.baseInfo.AnnotationType;
//import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
//import com.inspur.edp.cef.api.attr.CefDataAttribute;
//import com.inspur.edp.cef.api.attr.ChildEntityAttribute;
//import com.inspur.edp.cef.gencommon.MediateType;
//import com.inspur.edp.cef.generator.DotNetToJavaStringHelper;
//import com.inspur.edp.cef.generator.apiGenerator.CefApiGeneratorContext;
//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.CefDataTypeImplGenerator;
//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.CefDataTypeImplGeneratorContext;
//import com.inspur.edp.cef.generator.coreGenerator.base.entityGenerator.validations.DataTypeValidationsGenerator;
//import com.inspur.edp.cef.generator.coreGenerator.base.serializer.DataTypeSerializerGenerator;
//import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.CommonModelCoreGeneratorContext;
//import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.entityGenerator.validations.EntityValsGenerator;
//import com.inspur.edp.cef.generator.coreGenerator.entityGenerator.serializer.EntityDataSerializerGenerator;
//import com.inspur.edp.cef.generator.entityGenerator.BaseEntityGeneratorContext;
//import com.inspur.edp.cef.generator.overall.Utils;
//import com.inspur.edp.cef.spi.entity.AbstractDTEntity;
//import com.inspur.edp.cef.spi.extend.DataExtendInfoAttribute;
//import com.inspur.edp.das.commonmodel.IGspCommonObject;
//import java.util.ArrayList;
//import java.util.Collections;
//import java.util.HashMap;
//import java.util.List;
//import org.eclipse.jdt.core.dom.Expression;
//import org.eclipse.jdt.core.dom.StringLiteral;
//import org.eclipse.jdt.core.dom.TypeLiteral;
//public abstract class EntityImplGenerator extends CefDataTypeImplGenerator {
//  protected CommonModelCoreGeneratorContext getCmCoreGenCtx() {
//    return (CommonModelCoreGeneratorContext) super.coreGenContext;
//  }
//
//  protected IGspCommonObject getCommonObject() {
//    return (IGspCommonObject) super.dataType;
//  }
//
//  protected EntityImplGenerator(
//      CommonModelCoreGeneratorContext coreGenContext, IGspCommonObject commonObject) {
//    super(coreGenContext, commonObject);
//    if (getCommonObject().getParentObject() == null) {
//      getCmCoreGenCtx().setRootEntityImplType(new MediateType(coreGenContext.getPackageName(), getName()));
//    }
//    // if (CommonObject.ParentObject != null)
//    // {
//    //    EntityImplGenCtx parentImplCtx = (getParentGenerator() as EntityImplGenerator).Context;
//    //    parentImplCtx.ChildEntityImplTypes.add(this.CommonObject.getCode(), new
//    // MediateType(getNameSpace(), getName()));
//    // }
//
//  }
//

//  // keyword:
//  // ORIGINAL LINE: protected new EntityImplGenCtx getContext() { return
//  // (EntityImplGenCtx)super.getContext(); }
//  @Override
//  protected EntityImplGenCtx getContext() {
//    return (EntityImplGenCtx) super.getContext();
//  }
//
//  @Override
//  protected final CefDataTypeImplGeneratorContext createImplGenContext() {
//    return createEntityImplGenCtx();
//  }
//
//  @Override
//  protected TypeInfo setParentClass() {
//    return Utils.createTypeInfo(AbstractDTEntity.class);
//  }
//
//  protected abstract EntityImplGenCtx createEntityImplGenCtx();
//
//  @Override
//  protected void dataTypeImplAfterGenerate() {
//    super.dataTypeImplAfterGenerate();
//  }
//
//  @Override
//  protected final java.util.ArrayList<AnnotationInfo> getDataTypExtendAttribute() {
//    java.util.ArrayList<AnnotationInfo> list = new java.util.ArrayList<AnnotationInfo>();
//    java.util.ArrayList<AnnotationInfo> extendGenerators = getEntityExtendAttrbites();
//    if (extendGenerators != null) {
//      list.addAll(extendGenerators);
//    }
//    list.addAll(getChildImplsAttribute());
//    // 现在主表的CefData标签打在Manager了, 所以只需要把子表的打到Entity实现类上
//    if (getCommonObject().getParentObject ()!= null) {
//      list.add(getCefDataAttribute());
//    }
//    return list;
//  }
//
//  private AnnotationInfo getCefDataAttribute() {
//
//
//    AnnotationInfo tempVar = new AnnotationInfo();
//    tempVar.setAnnotationType(AnnotationType.Normal);
//    tempVar.setTypeInfo(Utils.createTypeInfo(CefDataAttribute.class));
//    HashMap<String, Expression> annoParams = new HashMap<String, Expression> ();
//    TypeLiteral dataInterfaceLiteral = ast.newTypeLiteral();
//    dataInterfaceLiteral.setType(ast.newSimpleType(ast.newName(((BaseEntityGeneratorContext)coreGenContext
//        .getCefGenContext().getEntityGenContext()).getNodeTypes().get(getCommonObject().getCode()).getFullName())));
//    annoParams.put("dataInterfaceType", dataInterfaceLiteral);
//    String serType =
//        getCommonObject().getParentObject ()== null
//            ? coreGenContext.getChangeSerializerType().getFullName()
//            : coreGenContext
//                .getChildChangeSerializerType()
//                .get(getCommonObject().getCode())
//                .getFullName();
//    if(!DotNetToJavaStringHelper.isNullOrEmpty(serType))
//    {TypeLiteral serTypeLiteral = ast.newTypeLiteral();
//    serTypeLiteral.setType(ast.newSimpleType(ast.newName(serType)));
//    annoParams.put("serItemType", serTypeLiteral);
//    }
//    tempVar.setParams(annoParams);
//    return tempVar;
//  }
//
//  // [ChildEntitiesAttribute(new EntityTypeInfo(){new EntityTypeInfo("ss",typeof(A1),typeof(A2)),new
//  // EntityTypeInfo("bb",typeof(B1),typeof(B22))})]
//  private java.util.ArrayList<AnnotationInfo> getChildImplsAttribute() {
//    java.util.ArrayList<AnnotationInfo> list = new java.util.ArrayList<AnnotationInfo>();

//    for (IGspCommonObject item : getCommonObject().getContainChildObjects()) {
//      AnnotationInfo tempVar = new AnnotationInfo();
//      tempVar.setTypeInfo(Utils.createTypeInfo(ChildEntityAttribute.class));
//      tempVar.setAnnotationType(AnnotationType.Normal);
//      tempVar.setParams(getChildEntityAttribute(item));
//      list.add(tempVar);
//    }
//    return list;
//  }
//
//  private java.util.HashMap<String, Expression> getChildEntityAttribute(
//      IGspCommonObject childObject) {
//    java.util.HashMap<String, Expression> result = new HashMap(3);
//    String childCode = childObject.getCode();
//    StringLiteral nodeCodeLiteral = ast.newStringLiteral();
//    nodeCodeLiteral.setLiteralValue(childCode);
//    result.put("nodeCode", nodeCodeLiteral);
//    MediateType interfaceTp =
//        ((CefApiGeneratorContext)getContext().getCoreGenContext().getCefGenContext().getApiGenContext()).getEntityInterfaceTypes().get(childObject.getCode());
//    TypeLiteral interfaceTypeLiteral = ast.newTypeLiteral();
//    interfaceTypeLiteral.setType(ast.newSimpleType(ast.newName(interfaceTp.getFullName())));
//    result.put("entityActionType", interfaceTypeLiteral);
//    MediateType allInterfaceTp =
//        ((CefApiGeneratorContext)getContext().getCoreGenContext().getCefGenContext().getApiGenContext()).getEntityAllInterfaceTypes()
//            .get(childObject.getCode());
//    TypeLiteral allInterfaceTypeLiteral = ast.newTypeLiteral();
//    allInterfaceTypeLiteral.setType(ast.newSimpleType(ast.newName(allInterfaceTp.getFullName())));
//    result.put("entityAllType", allInterfaceTypeLiteral);
//    MediateType implType = getContext().getCoreGenContext().getEntityImplTypes().get(childObject.getCode());
//    TypeLiteral impTypeLiteral = ast.newTypeLiteral();
//    impTypeLiteral.setType(ast.newSimpleType(ast.newName(implType.getFullName())));
//    result.put("entityActionImplType", impTypeLiteral);
//
//    return result;
//  }
//
////  public final ExpressionSyntax getTypeArrayExpression() {
////    return SyntaxFactory.ArrayCreationExpression(
////            SyntaxFactory.ArrayType(TypeUtils.getTypeSyntax(EntityTypeInfo.class))
////                .WithRankSpecifiers(
////                    SyntaxFactory.<ArrayRankSpecifierSyntax>SingletonList(
////                        SyntaxFactory.ArrayRankSpecifier(
////                            SyntaxFactory.<ExpressionSyntax>SingletonSeparatedList(
////                                SyntaxFactory.OmittedArraySizeExpression())))))
////        .WithInitializer(
////            SyntaxFactory.InitializerExpression(
////                SyntaxKind.ArrayInitializerExpression,
////                SyntaxFactory.<ExpressionSyntax>SeparatedList(
////                    GetInitializer()))); // SyntaxFactory.IdentifierName("System.Type"))
////  }
//
////  private SyntaxNodeOrToken[] GetInitializer() {
////    java.util.ArrayList<SyntaxNodeOrToken> list = new java.util.ArrayList<SyntaxNodeOrToken>();

////    for (var item : getCommonObject().getContainChildObjects()) {
////      TypeSyntax interfaceType =
////          SyntaxFactory.IdentifierName(
////              getContext().getCoreGenContext().getCefGenContext().getEntityInterfaceTypes()
////                  .get(item.getCode())
////                  .getFullName());
////      TypeSyntax allInterfaceType =
////          SyntaxFactory.IdentifierName(
////              getContext().getCoreGenContext().getCefGenContext().getEntityAllInterfaceTypes()
////                  .get(item.getCode())
////                  .getFullName());
////      MediateType implType = Context.CoreGenContext.getEntityImplTypes().get(item.getCode());
////
////      list.add(GetSingleToken(item.getCode(), interfaceType, allInterfaceType, implType));
////
////      if (CommonObject.getContainChildObjects().indexOf(item)
////          < CommonObject.getContainChildObjects().size() - 1) {
////        list.add(SyntaxFactory.Token(SyntaxKind.CommaToken));
////      }
////    }
////    return list.toArray(new SyntaxNodeOrToken[] {});
////  }
//
////  private SyntaxNodeOrToken getSingleToken(
////      String nodeCode,
////      TypeSyntax interfaceType,
////      TypeSyntax allInterfaceType,
////      MediateType implType) {
////    return SyntaxFactory.ObjectCreationExpression(TypeUtils.getTypeSyntax(EntityTypeInfo.class))
////        .WithArgumentList(
////            SyntaxFactory.ArgumentList(
////                SyntaxFactory.<ArgumentSyntax>SeparatedList(
////                    new SyntaxNodeOrToken[] {
////                      SyntaxFactory.Argument(
////                          SyntaxFactory.LiteralExpression(
////                              SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(nodeCode))),
////                      SyntaxFactory.Token(SyntaxKind.CommaToken),
////                      SyntaxFactory.Argument(SyntaxFactory.TypeOfExpression(interfaceType)),
////                      SyntaxFactory.Token(SyntaxKind.CommaToken),
////                      SyntaxFactory.Argument(SyntaxFactory.TypeOfExpression(allInterfaceType)),
////                      SyntaxFactory.Token(SyntaxKind.CommaToken),
////                      SyntaxFactory.Argument(
////                          SyntaxFactory.TypeOfExpression(
////                              SyntaxFactory.IdentifierName(implType.ClassName)))
////                    })));
////  }
//
//  @Override
//  protected final DataTypeValidationsGenerator getValGenerator() {
//    return getEntityValGenerator();
//  }
//
//  protected abstract EntityValsGenerator getEntityValGenerator();
//
//  protected java.util.ArrayList<AnnotationInfo> getEntityExtendAttrbites() {
//    return null;
//  }
//
//  @Override
//  protected java.util.ArrayList<BaseGenerator> createClassExtendChildGenrators() {
//    java.util.ArrayList<BaseGenerator> list = super.createClassExtendChildGenrators();
//    if (list == null) {
//      list = new java.util.ArrayList<BaseGenerator>();
//    }

//    for (IGspCommonObject item : getCommonObject().getContainChildObjects()) {
//      list.add(createChildEntityImplGenerators(item));
//    }
//
//    return list;
//  }
//
//  protected abstract EntityImplGenerator createChildEntityImplGenerators(
//      IGspCommonObject childObject);
//
//  @Override
//  protected DataTypeSerializerGenerator getSerializerGenerator() {
//    return new EntityDataSerializerGenerator(getContext());
//  }
//}
